<%@taglib uri="/tags/struts-html" prefix="html"%>  
<%@taglib uri="/tags/struts-bean" prefix="bean" %> 
<%@taglib uri="/tags/struts-logic" prefix="logic" %>
<%@taglib uri="/WEB-INF/struts-layout.tld" prefix="layout" %>
<style type="text/css" media="screen">@import "../cl/css/body.css";</style>
<script language="JavaScript" type="text/JavaScript" src="../cl/js/jquery.validate.js"></script>
<script language="JavaScript" type="text/JavaScript" src="../cl/js/jquery-ui-1.8.11.custom.min.js"></script>
<%
String accionForm=(String)request.getAttribute("accion");
%> 
<div id="stylized" class="myform">
<html:form action="mttoSucursal">
		<h1>Sucursales</h1>
		<p><br/></p>
		<label>Empresa:</label>
		<html:select property="codigoEmpresa">
			<html:option value="0">Seleccione</html:option> 
			<html:optionsCollection name="SucursalForm" property="empresaList" label="nombreEmpresa" value="codigoEmpresa" />
		</html:select>
		<br/><br/>
		<label>Sucursal:</label>
		<html:text property="nombreSucursal"></html:text>
		<br/><br/>
	    <label>Tel&eacute;fono:</label>
		<html:text property="telefono"></html:text>
		<br/><br/>
		<label>Direcci&oacute;n:</label>
		<html:text property="direccion"></html:text>
		<br/><br/>
		<label>Comentarios:</label>
		<html:textarea property="descripcion"></html:textarea>
		<br/><br/>
	<html:hidden name="action" property="action" value="<%=accionForm%>"></html:hidden>
	<html:submit value="<%=accionForm%>"/>
	<br/><br/>
</html:form >
</div>
<script type="text/javascript" charset="utf-8">
	//funcion para validar el form 
	document.getElementsByName('SucursalForm')[0].id="iSucursalForm";
	$(document).ready(function() {
		$("#iSucursalForm").validate({
			rules: {
			telefono: {
			  required: true,
			  number: true,
			  maxlength: 8
			},
			nombreSucursal: {
			  required: true,
			  maxlength: 50
			},
			direccion: {
			  required: true,
			  maxlength: 50
			},
			descripcion: {
			  required: false,
			  maxlength: 100
			}
		  }
		});
	});
</script>